package main

import "fmt"

type Human struct {
	name string
	sex  string
}

func (this *Human) Eat() {
	fmt.Println("Human Eat...")
}

func (this *Human) Walk() {
	fmt.Println("Human Walk...")
}

type SuperMan struct {
	Human // SuperMan类继承了Human类
	level int
}

// Eat 重定义父类的方法Eat()
func (this *SuperMan) Eat() {
	fmt.Println("SuperMan Eat...")
}

// Fly 子类的新方法
func (this *SuperMan) Fly() {
	fmt.Println("SuperMan Fly...")
}

func (this *SuperMan) Print(){
	fmt.Println("name = ", this.name)
	fmt.Println("sex = ", this.sex)
	fmt.Println("level = ", this.level)
}

func main() {
	human := Human{"zhang3", "20"}
	human.Eat()

	//superMan := SuperMan{Human{
	//	"li4",
	//	"32",
	//}, 10}
	var superMan SuperMan
	superMan.name = "li4"
	superMan.sex = "22"
	superMan.level = 1
	superMan.Eat()
	superMan.Fly()
	superMan.Print()
}
